<?php
define('IN_ECS', true);
require('../includes/init.php');
include_once('fmconfig.php');
$fmuid = $_SESSION['user_id'];
$info = '';
//һ������
$sql1 = "select b.* from `fm_sys_code` as a left join `fm_sys_code` as b on a.CODE_ID = b.PARENT_NO where a.CODE_NO = 'STAGE'"; 
//echo var_dump($sql1);
$data = $GLOBALS['db']->getAll($sql1);
//echo var_dump($data);

$menu = '';
foreach($data as $d){
	$menu .= "<item label='".$d['CODE_NAME']."'>";
	$sql2 = "select b.* from `fm_sys_code` as a left join `fm_sys_code` as b on a.CODE_ID = b.PARENT_NO where a.CODE_ID=".$d['CODE_ID']." and b.CODE_NAME <> ''";	
	$data1 = $GLOBALS['db']->getAll($sql2);
	//echo var_dump($data1);
	if(count(data1)>0){
	foreach($data1 as $d1){
		$menu .= "<item id='".$d1['CODE_ID']."' label='".$d1['CODE_NAME']."' data='".$d1['CODE_ID']."' />";
	}
}
	$menu .= "</item>";
}
$menu = '<root>'.$menu.'</root>';

echo $menu;


?>